[Edward Alvin] ip#305
Conversation
[Edward Alvin] Create Duke Skeleton, ip
Add new Exceptions for basic invalid inputs
| return Duke.LIST.equals(word); | ||
| public static void processInput(InputType inputType, String value) { | ||
| switch(inputType) { | ||
| case LIST: |
There was a problem hiding this comment.
According to the codestyle, there should be no intentation for 'case' clauses in the switch block.
| public static boolean isList(String word) { | ||
| return Duke.LIST.equals(word); | ||
| public static void processInput(InputType inputType, String value) { | ||
| switch(inputType) { |
There was a problem hiding this comment.
Minor style-related thing, but there should be a space before the bracket i.e switch (inputType)
| Object[] parseResult = InputParser.parseInput(input); | ||
| InputType inputType = (InputType) parseResult[0]; | ||
| String value = (String) parseResult[1]; | ||
| String[] value = (String[]) parseResult[1]; |
There was a problem hiding this comment.
Why the cast to String[] array here, instead of making InputParser::parseInput(input) return a String[] instead of Object[]?
| value = ""; | ||
| if (inputType.label.length() < input.length()) { | ||
| value = input.substring(inputType.label.length() + 1); | ||
| if (inputType == InputType.BYE || inputType == InputType.LIST) { |
There was a problem hiding this comment.
Maybe it would be neater to separate out into boolean variables for example isBye, isList, etc to be in line with the code quality guideline
muraddurrani
left a comment
There was a problem hiding this comment.
Generally I found it quite easy to read all the code. I think you just need to adjust some small things like renaming arrays and arraylists to be plural form.
| Object[] parseResult = InputParser.parseInput(input); | ||
| InputType inputType = (InputType) parseResult[0]; | ||
| String[] value = (String[]) parseResult[1]; |
There was a problem hiding this comment.
I think parseResult and value could both be renamed in plural form (results and values perhaps?) to be consistent with naming conventions. I noticed this in a few other places.
| } | ||
| } | ||
|
|
||
| public static void processInput(InputType inputType, String[] value) { |
There was a problem hiding this comment.
Small thing because its just a parameter but maybe change value to values so its plural?
| @@ -0,0 +1,12 @@ | |||
| public class Todo extends WordListItem{ | |||
There was a problem hiding this comment.
I think there should be a space between WordListItem and {.
| @@ -0,0 +1,5 @@ | |||
| public class UnknownInputException extends Exception{ | |||
There was a problem hiding this comment.
I think there should be a space between Exception and {.
| import java.util.ArrayList; | ||
|
|
||
| public class WordList { | ||
| private ArrayList<WordListItem> wordList; |
There was a problem hiding this comment.
Perhaps this could be renamed to words or something similar to be plural?
| System.out.println(this); | ||
| } | ||
|
|
||
| public int length() { |
There was a problem hiding this comment.
The coding standards suggest that method names be verbs. Perhaps this could be changed to getLength or something like that.
…efactor the rest of the code
The sort command does not exist yet. The sort command allows more functionality for the user which will come really handy. Let's, * create the sort, sortevent, and sortdeadline command in inputtype * update the inputparser and wordlist to adjust
Duked
Duked frees your mind of having to remember things you need to do. It's,
All you need to do is,
And it is FREE! Features:
Just double click on the jar and it should open the app GUI :) or Run java -jar Duke.jar //depending on the relative location of the app |
No description provided.